import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "node:path";

export default defineConfig({
    plugins: [vue()],
    server: {
        port: 3000,
        proxy: {
            '^/api': {
                target: 'http://localhost:8080',
                changeOrigin: true, // 更改请求的来源
                rewrite: (path) => path.replace(/^\/api/, ''),
            },
        },
    },
    resolve: {
        alias: {
            '@': path.resolve(__dirname, 'src')
        },
        extensions: ['.js', '.ts', '.vue', '.json']
    }
})
